import { getToken, setToken, delToken } from '@/utils/storage'
export default {
  namespaced: true,
  // 存token
  state () {
    return {
      token: getToken()
    }
  },
  mutations: {
    setUserToken (state, newToken) {
      state.token = newToken
      setToken(newToken)
    },
    removeToken (state) {
      // 删除本地token
      delToken()
      // state里的token置空
      state.token = null
    }
  }
}
